#include <stdlib.h>
#include <stdio.h>
#include "hashTable.h"

void main() {
  struct HashTable * ht = newHashTable();
  char * ip = "123.45.3.5";
  struct PeerList * peerList = newPeer(NULL, 200, ip);
  displayPL(peerList);
  displayHT(ht);
  struct Peer * p = searchPeer(peerList, ip);
  addFile(ht, p, "toto", 787, 100, "era234rt");
  addFile(ht, p, "tito", 787, 100, "feza234rt");
  addFile(ht, p, "tota", 787, 100, "era234rt");
  peerList = newPeer(peerList, 20, "123.4.1.2");
  struct Cell * res1 = searchKey(ht, "toto"); 
  struct Cell * res2 = searchKey(ht, "era234rt"); 
  printf("res 1 %p, res2 %p \n", res1, res2);
  displayPL(peerList);
  displayHT(ht);
  deletePeer(ht, peerList, p);
  displayPL(peerList);
  displayHT(ht);

freeSystem(ht, peerList);
}
